<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@include file="/common/header.jsp"%>
<%@ page import="net.sf.rose.business.service.GroupSevice" %>
<c:set var="path" value="..${ctx}/common"/>

<div class="pageContent">
	<form method="post" action="${path}/update.html?tableName=SYS_USER&tableAction=update" class="pageForm required-validate" onsubmit="return validateCallback(this, dialogAjaxDone);">
		<div class="pageFormContent" layoutH="56">
			<fieldset>
				<%
				String groupText = "";
					Object obj = request.getAttribute("user");
					if (obj != null) {
						java.util.Map<String, Object> user = (java.util.Map<String, Object>) obj;
						obj = user.get("GROUPS");
						if (obj != null) {
							groupText = GroupSevice.getService().getGroup(obj.toString()).getText();
						}
					}
				%>
				<dl>
					<dt>用户编号：</dt>
					<dd><input name="USER_ID" type="text" size="30" value="${user.USER_ID}" readonly="readonly" /></dd>
				</dl>
				<dl>
					<dt>用户名：</dt>
					<dd><input name="USER_NAME" type="text" size="30" value="${user.USER_NAME}" class="required" /></dd>
				</dl>
				<dl>
					<dt>用户姓名：</dt>
					<dd><input name="REAL_NAME" type="text" size="30" value="${user.REAL_NAME}" /></dd>
				</dl>
				<dl>
					<dt>上次登录时间：</dt>
					<dd><input name="LAST_LOGIN_TIME" type="text" size="30" value="${user.LAST_LOGIN_TIME}"  readonly="readonly" /></dd>
				</dl>
				<dl>
					<dt>工作组：</dt>
					<dd>
							<input type="hidden" value=""${user.GROUPS} id="group.id" name="GROUPS" />
							<input type="text" class="textInput" size="30" value="<%=groupText%>"  name="group.name" />
							<a class="btnLook" href="..${ctx}/common/view.html?jsp=base/group/group_tree" lookupGroup="group">参考</a>
					</dd>
				</dl>
				<dl>
					<dt>角色：</dt>
					<dd>
					<c:if test="${! empty role}">
					<c:forEach var="vo" items="${role}">
						<input type="checkbox" name="ROLES" value="${vo.ROLE_CODE}"  <c:if test="${fn:indexOf(user.ROLES, vo.ROLE_CODE)!=-1 }">checked</c:if>  />${vo.ROLE_NAME}
					</c:forEach>
					</c:if>
					</dd>
				</dl>
			</fieldset>
		</div>
		<div class="formBar">
			<ul>
				<!--<li><a class="buttonActive" href="javascript:;"><span>保存</span></a></li>-->
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit" >保存</button></div></div></li>
				<li>
					<div class="button"><div class="buttonContent"><button type="button" class="close">关闭</button></div></div>
				</li>
			</ul>
		</div>
	</form>
</div>

<div id="menuContent" class="menuContent" style="display:none; position: absolute;">
	<ul id="treeDemo" class="ztree" style="margin-top:0; width:180px; height: 300px;"></ul>
</div>

<script type="text/javascript">
/**
 * dialog上的表单提交回调函数
 * 服务器转回navTabId，可以重新载入指定的navTab. statusCode=DWZ.statusCode.ok表示操作成功, 自动关闭当前dialog
 *
 * form提交后返回json数据结构,json格式和navTabAjaxDone一致
 */

function dialogAjaxDone(json){
	DWZ.ajaxDone(json);
	if (json.statusCode == DWZ.statusCode.ok){
		// alert(json.callbackType);
		if(json.callbackType){
			// 从父窗体中根据ID取控件数组
			// var v = $("#bs_user_list", navTab.getCurrentPanel());
			// v[0].submit();
			// 从父窗体中根据ID取查询表单控件，然后提交它
			$(bs_user_list).submit();
			setTimeout(function(){$.pdialog.closeCurrent();}, 100);
		}
	}
}
</script>
